(function($){
    var common = {
        init:function(){
            this.addActivity();
            layer.config({extend: 'extend/layer.ext.js'})
        },
        addActivity:function(){
            $('#addActivity').click(function(){
                layer.prompt({
                    title: '请输入活动名称',
                    maxlength: 20
                }, function(value, index, elem){
                    $.ajax({
                        url:"http://wams.veryeast.cn/activity/meadin_activity/admin/index.php?a=addActivity",
                        type:"post",
                        dataType:"json",
                        data:{activityName:value},
                        success:function(data){
                            if(data.status==1){
                                layer.alert("活动添加成功!",{icon:1},function(){
                                    window.location.reload();
                                });
                            }else{
                                layer.msg(data.message);
                            }
                        }
                    });
                    layer.close(index);
                });
            });
        }
    };
    common.init();
})(jQuery);